<extend name="Public/publicHTML"/>


<block name="nav">
    <link rel="stylesheet" href="__COMMON__/bootstrap/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="__COMMON__/bootstrap/css/font-awesome.min.css" />
    <script src="__COMMON__/bootstrap/js/bootstrap.min.js"></script>
    <script src="__COMMON__/js/myAjax.js"></script>
    <br/>
</block>


<block name="content">
<section class="content">
<div class="container-fluid">
  <div class="panel panel-default">
    <div class="panel-heading">
      <h3 class="panel-title"><i class="fa fa-list"></i> 评论列表</h3>
    </div>
    <div class="panel-body">

        <div class="navbar navbar-default">
          <form action="{:U('comment_list')}" id="search" class="navbar-form form-inline" method="GET">
            <div class="form-group">
                <select id="search-user" name="type">
                    <option value="none" <if condition="$where['type'] eq 'none' ">selected </if> >--准确查找--</option>
                    <option value="user_id" <if condition="$where['type'] eq 'user_id' ">selected </if> >用户ID</option>
                    <option value="goods_id" <if condition="$where['type'] eq 'goods_id' ">selected </if> >商品ID</option>
                    <option value="order_id" <if condition="$where['type'] eq 'order_id' ">selected </if> >订单ID</option>
                </select>
                <input type="input" name="type_id" value="{$where['type_id']}" id="type_id">
            </div>
            <div class="form-group">
                <label for="search-content"> 关键内容 </label>
                <input type="input" name="content" id="search-content" value="{$where['content']}">
            </div>
            <!--排序规则-->
            <button type="submit" id="button-filter search-order"  onclick="javascript:$('#search').submit();" class="btn btn-primary btn-sm"><i class="fa fa-search"></i> 筛选</button>
          </form>
        </div>

        <div id="ajax_return">
            <div class="table-responsive">
                <table class="table table-bordered table-hover">
                    <thead>
                    <tr>
                        <th class="sorting text-left">评价ID</th>
                        <th class="sorting text-left">商品</th>
                        <th class="sorting text-left">用户</th>
                        <th class="sorting text-left">内容</th>
                        <th class="sorting text-left">评分</th>
                        <th class="sorting text-left">时间</th>
                        <th class="sorting text-left">可见</th>
                        <th class="sorting text-left">操作</th>
                    </tr>
                    </thead>
                    <tbody>

                    <foreach name="list" item="vo">
                    <tr>
                        <td>{$vo['id']}</td>
                        <td>{$vo['goods_id']}</td>
                        <td>{$vo['user_id']}</td>
                        <td>{$vo['content']}</td>
                        <td>{$vo['score']}</td>
                        <td>{$vo['create_time']|date="Y-m-d H:i",###}</td>
                        <td>
                         <img width="20" height="20" src="__PUBLIC__/Admin/img/<if condition='$vo[status] eq 1'>yes.png<else />cancel.png</if>" onclick="changeTableVal('orderComment','id','{$vo.id}','status',this)"/>
                        </td>
                        <td>
                        <a class="btn btn-danger" onclick="delfunc(this)" data-url="{:U('comment/handle')}" data-id="{$vo['id']}"><i class="fa fa-trash-o"></i></a>
                        </td>
                    </tr>
                    </foreach>

                    </tbody>
                </table>
                <div class="page">{$page}</div>
            </div>
        </div>

            </div>
        </div>
    </div>
</section>

<script type="text/javascript" src="__COMMON__/js/alert.js"></script> 
<script type="text/javascript">
function delfunc(obj){
    layer.confirm('确认删除？', {
          btn: ['确定','取消'] //按钮
        }, function(){
            $.ajax({
                type : 'post',
                url : $(obj).attr('data-url'),
                data : {act:'del',del_id:$(obj).attr('data-id')},
                dataType : 'json',
                success : function(data){
                    if(data==1){
                        layer.msg('操作成功', {icon: 1});
                        $(obj).parent().parent().remove();
                    }else{
                        layer.msg(data, {icon: 2,time: 2000});
                    }
                    layer.closeAll();
                }
            })
        }, function(index){
            layer.close(index);
            return false;// 取消
        }
    );
}
</script>
</block>